package Wormish.agiletre.se.Math;

import java.util.Random;

public class MathHelper
{
	private static Random random = new Random();
	
	public static float Clamp(float value, float min, float max)
	{
    	if(value < min)
    	{
    		value = min;
    	}
    	
    	if(value > max)
    	{
    		value = max;
    	}
    	
    	return value;
	}
    
    // Returns a float between [0, max)
    public static float Random(float max)
    {
    	return Random(0, max);
    }
    
    //Returns a float between [min, max)
    public static float Random(float min, float max)
    {
    	return random.nextFloat() * (max - min) + min;
    }

}
